function validation(){
	//right email expression 
	var re = /^\w{1,15}(?:@(?!-))(?:(?:[a-z0-9-]*)(?:[a-z0-9](?!-))(?:\.(?!-)))+[a-z]{2,4}$/;
	//gets userName and password from the form
	var userName = document.getElementById("userName").value;
	var password = document.getElementById("password").value;
	
	if (userName ==""){
		alert("please enter your user name.");
		return false;
  }else if (userName.length < 6){
  	alert("Username must be at least 6 characters");
  	return false;
   }else if (password ==""){
		alert("please enter your password.");
		return false;
  }else if (password.length < 6){
  	alert("Password must be at least 6 characters");
  	return false;
   }else if(!re.test(document.getElementById("email").value)){
  	alert("please enter a valid email address");
  	return false;
  }
  else{
  	return true;
  }
}